package com.fare.taluo.core.domain.config.line;

import java.util.Date;
import java.util.List;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.dayatang.domain.InstanceFactory;

@javax.persistence.Entity
@Table(name = "USER_CARE_LINE")
@Cacheable
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class UserCareLineEntity extends com.fare.taluo.base.ddd.domain.BaseEntity{
	private static final long serialVersionUID = 375171077416722709L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	/**
	 * 用户ID
	 */
	@Column(name = "userid")
	private Long userId;
	// 用户名
	@Column(name = "username")
	private String username;

	// 出发城市
	@Column(name = "departcity")
	private String departcity;

	// 到达城市
	@Column(name = "arrivalcity")
	private String arrivalcity;

	// 操作日期
	@Column(name = "createtime")
	private Date createTime = new Date();

	// 出发城市/机场三字码
	@Column(name = "departcitycode")
	private String departcitycode;
	
	// 到达城市/机场三字码
	@Column(name = "arrivalcitycode")
	private String arrivalcitycode;
	// 关注航线是否是城市
	@Column(name = "iscity")
	private int iscity;
	/**
	 * 排序号
	 */
	@Column(name = "priority")
	private int priority = 0;
	
	public UserCareLineEntity() {}

	private static UserCareLineEntityRepository userCareLineEntityRepository;

	public static UserCareLineEntityRepository getUserCareLineEntityRepository() {
		if (userCareLineEntityRepository == null) {
			userCareLineEntityRepository = InstanceFactory
					.getInstance(UserCareLineEntityRepository.class);
		}
		return userCareLineEntityRepository;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	// 查找
	public List<UserCareLineEntity> findLine(Long userId) {
		return getUserCareLineEntityRepository().findLine(userId);
	}

	public List<UserCareLineEntity> findLine(Long userId,
			String depatcity, String arrivalcity) {
		return getUserCareLineEntityRepository().findLine(userId,
				depatcity, arrivalcity);
	}
	
	@Override
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getDepartcity() {
		return departcity;
	}

	public void setDepartcity(String departcity) {
		this.departcity = departcity;
	}

	public String getArrivalcity() {
		return arrivalcity;
	}

	public void setArrivalcity(String arrivalcity) {
		this.arrivalcity = arrivalcity;
	}



	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getDepartcitycode() {
		return departcitycode;
	}

	public void setDepartcitycode(String departcitycode) {
		this.departcitycode = departcitycode;
	}

	public String getArrivalcitycode() {
		return arrivalcitycode;
	}

	public void setArrivalcitycode(String arrivalcitycode) {
		this.arrivalcitycode = arrivalcitycode;
	}

	public int getIscity() {
		return iscity;
	}

	public void setIscity(int iscity) {
		this.iscity = iscity;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	@Override
	public String toString() {
		return "UserCareLineEntity [id=" + id + ", userId=" + userId
				+ ", username=" + username + ", departcity=" + departcity
				+ ", arrivalcity=" + arrivalcity + ", createTime=" + createTime
				+ ", departcitycode=" + departcitycode + ", arrivalcitycode="
				+ arrivalcitycode + ", iscity=" + iscity + "]";
	}
	
}
